From 306921aa6fe884cd988244e8ad4644a1c76d8cea Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Tue, 20 May 2008 14:50:45 +0100 Subject: [PATCH] xend: Support HVM S3 resume. Signed-off-by: Yu Ke Signed-off-by: Ke Liping Signed-off-by: Keir Fraser --- tools/python/xen/xend/XendConstants.py | 5 ++++- tools/python/xen/xend/XendDomain.py | 3 +++ tools/python/xen/xm/main.py | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/python/xen/xend/XendConstants.py b/tools/python/xen/xend/XendConstants.py index 75f9d98c43..8b98286841 100644 --- a/tools/python/xen/xend/XendConstants.py +++ b/tools/python/xen/xend/XendConstants.py @@ -48,6 +48,7 @@ HVM_PARAM_VHPT_SIZE = 8 HVM_PARAM_BUFPIOREQ_PFN = 9 HVM_PARAM_TIMER_MODE = 10 HVM_PARAM_HPET_ENABLED = 11 +HVM_PARAM_ACPI_S_STATE = 14 restart_modes = [ "restart", @@ -102,11 +103,13 @@ LAST_SHUTDOWN_REASON = 'xend/last_shutdown_reason' TRIGGER_NMI = 0 TRIGGER_RESET = 1 TRIGGER_INIT = 2 +TRIGGER_S3RESUME = 3 TRIGGER_TYPE = { "nmi" : TRIGGER_NMI, "reset" : TRIGGER_RESET, - "init" : TRIGGER_INIT + "init" : TRIGGER_INIT, + "s3resume": TRIGGER_S3RESUME } # diff --git a/tools/python/xen/xend/XendDomain.py b/tools/python/xen/xend/XendDomain.py index 1d86f4160a..0089090364 100644 --- a/tools/python/xen/xend/XendDomain.py +++ b/tools/python/xen/xend/XendDomain.py @@ -1657,6 +1657,9 @@ class XendDomain: trigger = TRIGGER_TYPE[trigger_name.lower()] else: raise XendError("Invalid trigger: %s" % trigger_name) + if trigger == TRIGGER_S3RESUME: + xc.hvm_set_param(dominfo.getDomid(), HVM_PARAM_ACPI_S_STATE, 0) + return None try: return xc.domain_send_trigger(dominfo.getDomid(), trigger, diff --git a/tools/python/xen/xm/main.py b/tools/python/xen/xm/main.py index a7351dbd1a..01660ca297 100644 --- a/tools/python/xen/xm/main.py +++ b/tools/python/xen/xm/main.py @@ -143,7 +143,7 @@ SUBCOMMAND_HELP = { 'Get/set credit scheduler parameters.'), 'sysrq' : (' ', 'Send a sysrq to a domain.'), 'debug-keys' : ('', 'Send debug keys to Xen.'), - 'trigger' : (' []', + 'trigger' : (' []', 'Send a trigger to a domain.'), 'vcpu-list' : ('[Domain, ...]', 'List the VCPUs for all/some domains.'), -- 2.30.2